package com.jx.driving.request.domain;

import java.io.Serializable;
import java.util.Arrays;

import com.jx.driving.protocol.terminal.annotation.DynamicByteArrayAnnotation;
import com.jx.driving.protocol.terminal.annotation.LimitedStringAnnotation;
import com.jx.driving.protocol.terminal.annotation.TailByteArrayAnnotation;
import com.jx.driving.protocol.terminal.annotation.TerminalAnnotation;
import com.jx.driving.protocol.terminal.annotation.WordAnnotation;

/**
 * 透传消息内容 TODO 动态编解码content
 * 
 * @author shenliuyang
 *
 *         2016年8月14日下午4:27:10
 */
@TerminalAnnotation
public class DynamicObject implements Serializable {
	private static final long serialVersionUID = -6593978397633196152L;

	@WordAnnotation(order = 1)
	private int id;// 消息id
	@WordAnnotation(order = 2)
	private int ext;// 扩展消息
	@WordAnnotation(order = 3)
	private int serialNo;// 教培包序号
	@LimitedStringAnnotation(value = 16, order = 4)
	private String deviceNO;// 计时终端编号
	@DynamicByteArrayAnnotation(order = 5, value = 4)
	private byte[] content;// 数据内容
	@TailByteArrayAnnotation(order = 6)
	private byte[] checkCode;// 校验码

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getExt() {
		return ext;
	}

	public void setExt(int ext) {
		this.ext = ext;
	}

	public int getSerialNo() {
		return serialNo;
	}

	public void setSerialNo(int serialNo) {
		this.serialNo = serialNo;
	}

	public String getDeviceNO() {
		return deviceNO;
	}

	public void setDeviceNO(String deviceNO) {
		this.deviceNO = deviceNO;
	}

	public byte[] getContent() {
		return content;
	}

	public void setContent(byte[] content) {
		this.content = content;
	}

	public byte[] getCheckCode() {
		return checkCode;
	}

	public void setCheckCode(byte[] checkCode) {
		this.checkCode = checkCode;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("DynamicObject [id=").append(Integer.toHexString(id)).append(", ext=").append(ext)
				.append(", serialNo=").append(serialNo).append(", deviceNO=").append(deviceNO)
				.append(", content length =").append(content.length).append(", checkCode=")
				.append(Arrays.toString(checkCode)).append("]");
		return builder.toString();
	}

}
